<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<script type="text/javascript" charset="utf-8"
		src="<%=basePath%>ueditor/editor_all.js"></script> 
<script type="text/javascript" charset="utf-8"
		src="<%=basePath%>ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8"
		src="<%=basePath%>ueditor/editor_config.js"></script>
<div id='message'>
   
</div>
<form action="<%=basePath%>backend/updateteacher" class='form-horizontal' method="post" id='teacherForm'  enctype="multipart/form-data">

	<div class="row-fluid">
		<c:if test="${not empty teacher.pic }">
			<div class="span12 input-prepend">

				<div class="input-prepend">
					<label class="add-on">教师头像</label> <img alt=""
						src="<%=basePath%>${teacher.pic }"
						style='width: 100px; height: 100px;'>
				</div>


			</div>
		</c:if>
		<div class='span12 div-common'>
			<div class="span7 " style='height: 100px;'>

				<div class="control-group">
					<label class="control-label">图&nbsp;片&nbsp;上&nbsp;传（<span
						style='color: #990000;'>如果不修改教师头像，可不选择</span>）:
					</label>
					<div class="controls">
						<input type="file" class='form-control' name="fileste"
							id="picture" />
					</div>
				</div>
			</div>
			<div class="span5" id="photo">
				<font color="red">你添加了的图片：</font> <br>
			</div>
		</div>


	</div>
	<div class="row div-common" style='margin-left:118px;'>
               <div class="span5 input-prepend">
                  <span class="add-on">专		业:</span>
                  <select class="span6" id='major' name='major1'>
                  <option value='0'>---请选择---</option>
                  <c:forEach items="${ majors}" var="major">
                     <option value="${major.id }">${major.name }</option>
                  </c:forEach>
                  </select>
             
               </div>
              <div class="span5 input-prepend">
                  <span class="add-on">所属研究所:</span>
                  <select class="span6" id='researchlaId' name='researchlaId1'>
                  <option value='0'>---请选择---</option>
                  <c:forEach items="${ labs}" var="major">
                     <option value="${major.researchlabId }">${major.researchlabName }</option>
                  </c:forEach>
                  </select>
               </div>
               <!-- Optional: clear the XS cols if their content doesn't match in height -->
               <div class="clearfix visible-xs"></div>
           </div>
           
          <div class="row div-common" style='margin-top:10px;'> 
               <div class="span5 input-prepend" style='margin-left:15px;'>
                 <label class="add-on">所属实验室</label>
                  <select class="span9" id='labId1' name='labId1'>
                  <option value='0'>---请选择（可不选）---</option>
                  <c:forEach items="${ ilabs}" var="major">
                     <option value="${major.labId }">${major.labName }</option>
                  </c:forEach>
                  </select>     
               </div>
              <div class="span5 input-prepend"style='margin-left:15px;'>
                 <label class="add-on">教师姓名</label>
                  <input value=' ${teacher.name }' name="name" type="text" />
               </div>
           </div>
           <div class="row div-common" style='margin-top:10px;'>
              <div class="span5 input-prepend"style='margin-left:15px;'>
                 <label class="add-on">电		话</label>
                  <input name="phone" value='${teacher.phone }' type="text" />
               </div>
               <div class="span5 input-prepend"style='margin-left:15px;'>
                  <label class="add-on">教师编号</label>
                  <input  value='${teacher.no }' name="no" type="text" />
               </div>
               <!-- Optional: clear the XS cols if their content doesn't match in height -->
               <div class="clearfix visible-xs"></div>
              
           </div>
           <div class='row div-common' style='margin-top:10px;'>
             <div class=" span5 input-prepend"style='margin-left:15px;'>
		             <label class="add-on" for="">所属部门</label>     
			     
			    <select class="span6" id='branch' name='branch1'>
                  <option value='0'>---请选择（可不选）---</option>
                     <c:forEach items="${ departments}" var="major">
                     <option value="${major.dId }">${major.dName }</option>
                    </c:forEach>
                  </select> 
		     
               </div>
             <div class=" span5 input-prepend"style='margin-left:15px;'>
		             <label class="add-on" for="">职位</label>     
			      
			    <select class="span6" id='position1' name='position' >
                  <option value='0'>---请选择（可不选）---</option>
                     <option value="书记">书记</option>
                     <option value="主任">主任</option>
                     <option value="院长">院长</option>
                     <option value="副书记">副书记</option>
                     <option value="副院长">副院长</option>
                     <option value="分团委书记">分团委书记</option>
                     <option value="副主任">副主任</option>
                     <option value="组长">组长</option>
                     <option value="所长">所长</option>
                  </select> 
			        
               </div>
           </div> 
           <div class="row div-common" style='margin-top:10px;'>
           <div class="span5 input-prepend"style='margin-left:15px;'>
                 <label class="add-on">办公地点</label>
                  <input  name="officeLocation" type="text" />
               </div>
              <div class="span5 input-prepend"style='margin-left:15px;'>
                 <label class="add-on">Q		Q</label>
                  <input  value='${teacher.qq }' name="qq" type="text" />
               </div>
               
                 
               <!-- Optional: clear the XS cols if their content doesn't match in height -->
               <div class="clearfix visible-xs"></div>
              
           </div> 
           <div class='row '>
             <div class=" span5 control-group"  style='margin-top:10px;'>
		        <label class="control-label" >性别:</label>    
			      <div class=" controls" style='margin-top:9px;'>  
			         <input class=" radio inline"  type="radio" name="gender" value="男"> 男           
			         <input class="" type="radio" name="gender" value="女"> 女  
			        </div>      
               </div>
           </div>
           <div class='row '>
             <div class="span12 control-group" style='margin-top:10px;margin-left:15px;'>
                 <label class="control-label">类型:</label>
                   <div class=" controls" style='margin-top:9px;'> 
                   <c:forEach items="${teachertypes }" var="teachertype1">
                         <div class='span5' style='margin-left:0px;'>
                            <input class='checkbox' id='teacher${teachertype1.id }' name='${teachertype1.tName }' value='${teachertype1.id }' type="checkbox">${teachertype1.tName }
                         </div>
                   </c:forEach>
               </div>
               </div>
           </div>
           <div class='row' style='margin-top:10px;margin-left:0px;'>
              <div class="span5 control-group">
                 <span class="control-label">研究方向:</span>
                 <div class='controls'>
                 <textarea class='text-area'  name="direction"  >
                   ${teacher.direction }
                 </textarea>
                 </div>
               </div>
           </div>
           <div class="row" style='margin-top:10px;margin-left:15px;'>
              <div class="row" style='margin-top:10px;'>
              <div class="span5 control-group">
                 <span class="control-label">  主要项目 :    </span>
                 <div class='controls'>
                 <textarea class='text-area' name="project">
                   ${teacher.project }
                 </textarea>
                </div>
               </div>
               
              
           </div> 
           <div class='row' style='margin-top:10px;'>
             <div class="span5 control-group">
                 <span class="control-label">主要成就:</span>
                 <div class='controls'>
                 <textarea class='text-area' name="achievement">
                 ${teacher.achievement }
                 </textarea>
                 </div>
               </div>
           </div>
           
            
           
           
           
			<div class='div-common' style='margin-top: 10px;'>
			  <strong>教师简介</strong><br><br>
		       <script  id="editor" ></script>
		       </div>
	
		<input type="submit" value="完成" style="margin-left: 600px;margin-top: 10px;" class="btn btn-info" onclick="return getContent();"/></div>
		<input id="intro" type="hidden"  name="introduce" value="${teacher.introduce }">
		<input id='majorid' value='${teacher.majorId.id}' type="hidden"/>
		<input id='labid' type="hidden" value="${teacher.researchlaId.researchlabId}"  />
		
		<input id='pos' type="hidden" value="${teacher.position}"  />
		<input id='bran' type="hidden" value="${teacher.branch.dId}"  />
		<input id='ilabid' type="hidden" value="${teacher.labId.labId}"  />
		<input name='id' value='${teacher.id}' type="hidden"/>
		<input name='belong' id='belong1' type="hidden" />
		<c:forEach items="${ts }" var='i'>
		    <input  class='ts' id='' type="hidden" value="${i.id}" />
		</c:forEach>
		<!-- <input id='belong' name='belong' type="hidden" > -->
	</form>
	<script type="text/javascript">
<!--
var editor = new UE.ui.Editor();
editor.render("editor");
$(function(){
	//alert("213");
	//alert($("#majorid").val());
	var majorId = $("#majorid").val();
	
	var content = $("#intro").val();
     editor.ready(function(){
       editor.setContent(content);
      });
	var belong = $("#belong").val();
	var researchlabId = $("#labid").val();
	var ilabid = $("#ilabid").val();
	$("#researchlaId").val(researchlabId);
	$("#labId1").val(ilabid);
	$("#position1").val($("#pos").val());
	//alert($("#bran").val());
	$("#branch").val($("#bran").val());
	$("#major").val(majorId);
	$(".ts").each(function(){
		var id ="#" +"teacher"+ $(this).val();
		//alert(id);
		$(id).attr("checked","checked");
		 //$("#teacher1").attr("checked") ="checked";
	});
});
//-->
</script>
	<script type="text/javascript">
	
	var ue = UE.getEditor('editor');
    function getContent() {
        var str= ue.getContent();
        $("#intro").val(str);
        var str="";
        var result = 0;
        var id="";
        $(".checkbox").each(function(){
        	if($(this).attr("checked") == true || $(this).attr("checked") == "checked")
			  {
        		
				 id+=","+$(this).val();
			  }
        });
       // alert(id);
        
        $("#belong1").val(id);
        var id="";
       // result = 0;
        return true;
    }
</script>
